package com.serialcommunication.helper;

public class StringUtil {
	
	public static String cutLeadingZeros(String s, int usedHexSigns) {
		StringBuffer retValue = new StringBuffer("");
		char[] array = s.toCharArray();
		boolean stillOnlyZero = true;
		for (int i = 0; i<array.length; i++) {
			if (stillOnlyZero && usedHexSigns > 0) {
				if (array[i] != '0') {
					stillOnlyZero = false;
					retValue.append(array[i]);
				}
				else {
					usedHexSigns--;
				}
			}
			else {
				retValue.append(array[i]);
			}
		}
		return retValue.toString();
	}
}
